const connection = require('../app/database')

class AuthService {
    async checkResource(tableName, tableId, userId) {
        const statement = `SELECT * FROM ${tableName} WHERE id = ? AND user_id = ?;`;
        const [result] = await connection.execute(statement, [tableId, userId])
        return Boolean(result.length)
    }
}

module.exports = new AuthService()